package com.servitware.cardio.dokstat.transport;

import java.io.Serializable;

import com.servitware.util.net.WebApp;

public enum AppHost implements Serializable
{
	CardioRunning("http://www.cardiorunning.com"),
	Localhost("http://localhost/cardiorunning"),
	Servitware("http://servitware.org");

	
	AppHost(String url)
	{	
		this.url=url;
	}
	
	private String url;
	
	public String getUrl() 
	{
		return url;
	}
	
	public AppHost getUrlFromWebApp(WebApp webApp)
	{
		AppHost appHost = null;
		
		for( AppHost aH : AppHost.values() )
		{
			if( aH.getUrl().equalsIgnoreCase(webApp.getServer()))
			{
				appHost = aH;
				break;
			}
		}
		
		return appHost;
	}
	
	public String[] getUrlStrings()
	{
		String[] urls = new String[ AppHost.values().length ];
		int i = 0;
		
		for( AppHost a : AppHost.values() )
			urls[i++] = a.getUrl();
		
		return urls;
	}

}
